var messageOpts = {
    "closeButton": true,// 是否显示关闭按钮
    "positionClass": "toast-center-center",// 弹出窗的位置
    "showDuration": "1000",// 显示的动画时间
    "hideDuration": "1000",// 消失的动画时间
    "timeOut": "1500",// 弹窗展现时间
    "showEasing": "swing",//显示时的动画缓冲方式
    "hideEasing": "linear",//消失时的动画缓冲方式
    "showMethod": "fadeIn",//显示时的动画方式
    "hideMethod": "fadeOut", //消失时的动画方式
    "allowHtml":true,// 允许弹窗内容包含 HTML 语言
};


$(document).ready(function () {
    var userName = window.sessionStorage.getItem("userName");
    var href = window.sessionStorage.getItem("href");
    var roleId = window.sessionStorage.getItem("roleId");
    var roleName = window.sessionStorage.getItem("roleName");
    var portAddress = window.sessionStorage.getItem("portAddress");

    toastr.options = messageOpts;
    if (userName === "null") {
        options.warning('请登录');
        location.href = "/login"
    } else {
        var name = userName + "(" + roleName + ")";
        if(roleName === "null"){
            name = userName;
        }
        $("#user").text(name);
        if (href === "null") {
            $("img").attr("src","/img/index.jpg");
        }else {
            $("img").attr("src","/img/" + href);
        }
    }
    $("a[href='/userset']").attr("href","/userset?userName="+window.sessionStorage.getItem("userName"));
    $("a[href='/login']").click(function() {
        window.open(this.href,"_blank");
        window.close();
    })


    //该IP地址是fceCore项目的地址.是会随时变化的.
    window.portAddress = portAddress;

})
